using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using DG.Tweening;

public class GameOverScene : MonoBehaviour
{
    public Text scoreText, totalScoreText, starText, totalStarText, levelText, bestScoreText;
    public Button nextButton;
    public GameObject levelob;
    public Animator animator;
    public GameManagerLow managerLow;
    


    void Start()
    {
        managerLow.InitScore();

        scoreText.text = PlayerPrefs.GetInt(Const.Score).ToString();
        totalScoreText.text = PlayerPrefs.GetInt(Const.TotalScore).ToString();
        starText.text = PlayerPrefs.GetInt(Const.Star).ToString();
        totalStarText.text = PlayerPrefs.GetInt(Const.TotalStar).ToString();
        levelText.text = PlayerPrefs.GetInt(Const.Level, 1).ToString();
        bestScoreText.text = PlayerPrefs.GetInt(Const.BestScore).ToString();

        animator.Play("ShowScore");
    }
    

    public void OnNextClick()
    {
        string nowSceneName = SceneManager.GetActiveScene().name;
        int level = PlayerPrefs.GetInt(Const.Level);

        if (nowSceneName == "GameScene")
        {
            SceneManager.LoadScene("GameScene2");
            level++;
            PlayerPrefs.SetInt(Const.Level, level);
        }
        else
        {
            SceneManager.LoadScene("GameScene");
            level++;
            PlayerPrefs.SetInt(Const.Level, level);
        }
    }
}
